home *** CD-ROM | disk | FTP | other *** search
- /* Source code of prmscan - program scanning system for PCI cards plugged */
- /* into Prometheus board. It demonstrates use of prometheus.library. */
-
- #define __NOLIBBASE__ /* we do not want to peeking library bases */
-
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <proto/prometheus.h>
-
- struct Library *SysBase, *DOSBase, *PrometheusBase;
-
- const char *VString = "$VER: prmscan 1.1 (31.3.2001) © 2001 Matay.\n";
-
-
- LONG Main (void)
- {
- Printf ("\nPrmscan 1.1 © 2001 Matay.\n");
- Printf ("PCI cards listing:\n-------------------------------------------------\n");
- if (PrometheusBase = OpenLibrary ("prometheus.library", 1))
- {
- APTR board = NULL;
- ULONG vendor, device, revision, dclass, dsubclass, blkaddr, blksize;
- ULONG romaddr, romsize;
- WORD blk;
-
- while (board = Prm_FindBoardTags (board, TAG_END))
- {
- Prm_GetBoardAttrsTags(board,
- PRM_Vendor, (ULONG)&vendor,
- PRM_Device, (ULONG)&device,
- PRM_Revision, (ULONG)&revision,
- PRM_Class, (ULONG)&dclass,
- PRM_SubClass, (ULONG)&dsubclass,
- TAG_END);
- Printf ("Vendor %04lx, device %04lx, revision %ld.\n", vendor, device,
- revision);
- Printf ("Device class %02lx, subclass %02lx.\n", dclass, dsubclass);
- for (blk = 0; blk < 6; blk++)
- {
- Prm_GetBoardAttrsTags (board,
- PRM_MemoryAddr0 + blk, (ULONG)&blkaddr,
- PRM_MemorySize0 + blk, (ULONG)&blksize,
- TAG_END);
- if (blkaddr && blksize)
- {
- Printf ("Address range: %08lx - %08lx.\n", blkaddr, blkaddr + blksize
- - 1);
- }
- }
- Prm_GetBoardAttrsTags(board,
- PRM_ROM_Address, (ULONG)&romaddr,
- PRM_ROM_Size, (ULONG)&romsize,
- TAG_END);
- if (romaddr && romsize)
- {
- Printf ("%ld kB of ROM at %08lx - %08lx.\n", romsize >> 10, romaddr,
- romaddr + romsize - 1);
- }
- Printf ("-------------------------------------------------\n");
- }
- Printf ("\n");
- CloseLibrary (PrometheusBase);
- }
- else Printf ("No working Prometheus board found in the system.\n\n");
- return 0;
- }
-
-